import axios from 'axios'

const instance = axios.create({
 baseURL:
  'http://kumanxuan1.f3322.net:8001/',
  timeout:5000,
  headers: { 'X-Custom-Header': 'foobar' }
})
instance.interceptors.request.use(
  function(config){
    //设置 token
    let token = localStorage.getItem('token')
    if (token){
      config.headers['token']=token
       }
       return config
  },
  function(error){
    return Process.reject(error)
  }
)
//响应拦截器
instance.interceptors.response.use(
  response =>{
    return response.data
  }
)
export default instance